<!DOCTYPE html>
<html>
<head>
<title>Notifications</title>
<?php
$login = $_GET ["login"];
if (! empty ( $_GET ["wait"] ) && empty ( $_GET ["rmrap"] )) {
	echo '<meta charset="utf-8" HTTP-EQUIV="Refresh"';
	echo '	CONTENT="5;http://fr-d134685.groupinfra.com/showroom/iBeacon_project/iBeacon_project/web/client_notifications7.php?login=' . $login . '&wait=5">';
} else {
	echo '<meta charset="utf-8" HTTP-EQUIV="Refresh"';
	echo '	CONTENT="5; URL=http://fr-d134685.groupinfra.com/showroom/iBeacon_project/iBeacon_project/web/client_notifications7.php?login=' . $login . '">';
}
?>
<meta name="viewport" charset="utf-8"
	content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet" media="screen">
<!-- My style -->
<link href="../css/bootstrap.css" rel="stylesheet" media="screen">
<link href="../css/alert.css" rel="stylesheet">
<link href="../css/notification.css" rel="stylesheet">
</head>
<body>
	<div class="container">
		<div class="row">
			<br />
			<div
				class="col-xs-6 col-xs-offset-3 col-sm-6 col-md-3 col-lg-offset-4">
				<img class="img-responsive" src="../img/zodio.gif"
					style="border-radius: 8px;">
			</div>

			<br /> <br />

			<div class="col-md-12">
				<h2
					style="font-family: Helvetica neue; color: white; visibility: hidden;">
					<b>-</b>
				</h2>
					<?php
					if (! empty ( $_GET ["wait"] ) && empty ( $_GET ["rmrap"] )) {
						$wait = $_GET ["wait"];
						// TODO : Gerer par rapport a la duree qu'on a en parametre
						echo ' <div class="alert-message warning alert-dismissable">';
						echo ' 	<span class="glyphicon glyphicon-certificate"></span> <a';
						echo ' 	class="close" href="./client_ne_plus_solliciter.php?login=' . $login . '" data-dismiss="alert" aria-hidden="true"><i';
						echo ' 		class="glyphicon glyphicon-remove"></i></a>';
						echo '		<a href="./client_bienvenue_colis.php?login=' . $login . '&rappel=true&wait=' . $wait . '"><strong>RAPPEL : </strong>';
						echo ' 		Votre colis est pret !</a>';
						echo ' </div>';
					}
					require_once ("../services/ResponsableService.php");
					$login = $_GET ["login"];
					
					$responsableService = new ResponsableService ();
					$numClient = 0;
					if ($login == "mergoa") {
						$numClient = 3;
					} else if ($login == "defrao") {
						$numClient = 2;
					} else if ($login == "totov") {
						$numClient = 1;
					}
					$_SESSION ['promoNonLu'] = $responsableService->getPromoNonLuClient ( $numClient );
					
					$listPromoClient = $_SESSION ['promoNonLu'];
					if ($listPromoClient != null) {
						foreach ( $listPromoClient as $historique ) {
							$numPromo = $historique->getNumPromo ();
							$article = $responsableService->getArticlePromo ( $numPromo );
							echo ' <div class="alert-message warning alert-dismissable">';
							echo ' 	<span class="glyphicon glyphicon-certificate"></span> <a';
							echo ' 	class="close" href="../action/enleverNotifAction.php?login=' . $login . '&numPromo=' . $numPromo . '&numClient=' . $numClient . '" data-dismiss="alert" aria-hidden="true"><i';
							echo ' 		class="glyphicon glyphicon-remove"></i></a>';
							echo '		<a href="./client_affichage_promo.php?id=' . $article->getNumArticle () . '&login=' . $login . '"><strong>Vous avez recu une promotion !</strong>';
							echo ' 		Profitez en elle est exclusivement pour vous !</a>';
							echo ' </div>';
						}
					}
					?>
			</div>
			<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
			<br /> <br />
					<?php
					$login = $_GET ["login"];
					echo '	<div class="col-md-offset-2 col-md-8 text-center">';
					echo '		<a href="./client_ne_plus_solliciter.php?login=' . $login . '"';
					echo '			class="btn btn-default panel-footer text-center" role="button"><span';
					echo '			class="glyphicon glyphicon-remove"></span> Ne plus me solliciter</a>';
					echo '	</div>';
					echo '</div>';
					echo '<div class="col-md-offset-2 col-md-8 text-center">';
					echo '	<a href="../action/retirerClientConnecteAction.php?login=' . $login . '"';
					echo '		class="btn btn-default panel-footer text-center" role="button"><span';
					echo '		class="glyphicon"></span>Client détecté &agrave la sortie du magasin</a>';
					echo '</div>';
					?>
		</div>
	</div>

</body>
<footer>
	<script src="http://code.jquery.com/jquery.js"></script>
	<script src="../js/bootstrap.js"></script>
</footer>
</html>